#include "complete.h"
#include <iostream>

using namespace ads;

void view(const vector<string>& v) {
  for (vector<string>::const_iterator cit = v.begin(); cit != v.end(); ++cit) {
    cout << *cit << endl;
  }
}

int main(int argc, char *argv[]) {
  PrefixTree pt;
  string strs[] = {
  			"this is a book",
			"this is a test",
			"this only",
			"something else",
			"something nice",
			"someone cool"
                  };
  int strs_n = sizeof(strs) / sizeof(string);
  for (int i = 0; i < strs_n; ++i) {
    pt.insert(strs[i]);
  }
  pt.mark_remove("something else");
  pt.mark_remove("someone cool");
  pt.mark_remove("somethingXXXXXXX");

  vector<string> this_prefix, something_prefix, some_prefix, else_prefix;
  pt.complete("this", &this_prefix);
  pt.complete("something", &something_prefix);
  pt.complete("some", &some_prefix);
  pt.complete("else", &else_prefix);

  cout << "This prefix: " << endl;
  view(this_prefix);

  cout << "Something prefix: " << endl;
  view(something_prefix);

  cout << "Some prefix: " << endl;
  view(some_prefix);

  cout << "else prefix: " << endl;
  view(else_prefix);

  return 0;
}
